#ifndef FILTER_H
#define FILTER_H

#include <QObject>

#include "opencl.h"
#include "global_flag.h"

/// Filter class for transformations
class Filter : public QObject
{
    Q_OBJECT

    float _bias;
    float _factor;
    float* _filterMatrix;
    int _filterSize;
    bool _isParallel;
    int* _originalData;
    int _dataWidth;
    int _dataHeight;

    int* use_parallel_filter();
    int* use_non_parallel_filter();
private slots:
    void progress_cl(int);
public:
    Filter();
    ~Filter();
    void set_bias(const float bias);
    void set_factor(const float factor);
    void set_filter_matrix(const float* filterMatrix, const int filterSize);
    void set_original_data(int* data, const int width, const int height);
    void set_parallel(const bool isParallel, cl::Platform platform, cl::Device device);
    void disable_parallel();
    int* use_filter();

    int* _modifiedData; // To free from backend

    //This way backend can directly modify cl, no need to use filter
    OpenCL* _cl;

signals:
    void progress(int);
};

#endif // FILTER_H
